Java Database Programming with JDBC Java Database Programming with JDBC
by Pratik Patel
Coriolis, The Coriolis Group
ISBN: 1576100561   Pub Date: 10/01/96
  

Previous Table of Contents Next


Table 5.4 Statement ODBC calls.
JDBC Interface Method ODBC Call Comments
close SQLFreeStmt fOption = SQL_CLOSE
getMaxFieldSize SQLGetStmtOption fOption = SQL_MAX_LENGTH
setMaxFieldSize SQLSetStmtOption fOption = SQL_MAX_LENGTH
getMaxRows SQLGetStmtOption fOption = SQL_MAX_ROWS
setMaxRows SQLSetStmtOption fOption = SQL_MAX_ROWS
setEscapeProcessing SQLSetStmtOption fOption = SQL_NOSCAN
getQueryTimeout SQLGetStmtOption fOption = SQL_QUERY_TIMEOUT
setQueryTimeout SQLSetStmtOption fOption = SQL_QUERY_TIMEOUT
cancel SQLCancel Cancels the processing on a statement
setCursorName SQLSetCursorName Associates a cursor name with a statement
execute SQLExecDirect The Bridge checks for a SQL statement containing a ‘FOR UPDATE’ clause; if present, the cursor concurrency level for the statement is changed to SQL_CONCUR_LOCK
getUpdateCount SQLRowCount Returns the number of rows affected by an UPDATE, INSERT, or DELETE statement
getMoreResults SQLMoreResults Determines whether there are more results available on a statement and, if so, initializes processing for those results

Table 5.5 PreparedStatement ODBC calls.
JDBC Interface Method ODBC Call Comments
setNull SQLBindParameter fParamType = SQL_PARAM_INPUT; fSqlType = sqlType passed as parameter
setBoolean    
setByte    
setShort    
setInt    
setLong    
setFloat    
setDouble    
setNumeric    
setString    
setBytes    
setDate    
setTime    
setTimestamp SQLBindParameter fParamType = SQL_PARAM_INPUT; fSqlType is derived by the type of get method
setAsciiStream    
setUnicodeStream    
setBinaryStream SQLBindParameter fParamType = SQL_PARAM_INPUT, pcbValue = SQL_DATA_AT_EXEC
execute SQLExecute May return SQL_NEED_DATA (because of setAsciiStream, setUnicodeStream, or setBinary Stream); in this case, the Bridge will call SQLParamData and SQLPutData until no more data is needed

Table 5.6 CallableStatement ODBC calls.
JDBC Interface Method ODBC Call Comments
registerOutParameter SQLBindParameter fParamType = SQL_PARAM_OUTPUT; rgbValue is a buffer that has been allocated in Java; when using the getXXX methods, this buffer is used to retrieve the data

Table 5.7 ResultSet ODBC calls.
JDBC Interface Method ODBC Call Comments
next SQLFetch Fetches a row of data from a ResultSet
close SqlFreeStmt fOption = SQL_CLOSE
getString    
getBoolean    
getByte    
getShort    
getInt    
getLong    
getFloat    
getDouble    
getNumeric    
getBytes    
getTime    
getTimestamp SQLGetData fCType is derived by the type of get method
getAsciiStream    
getUnicodeStream    
getBinaryStream SQLGetData An InputStream object is created to provide a wrapper around the SQLGetData call; data is read from the data source as needed
getCursorName SQLGetCursorName Returns the cursor name associated with the statement


Previous Table of Contents Next